﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>
  
  <%@ include file="/WEB-INF/include/menu.jsp"%>

  <div class="container main-content">

    <div class="panel panel-default x-panel x-panel-layout">

      <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host}/content">内容管理</a></li>
          <li class="active">新闻数据</li>
        </ol>
      </div>

      <div class="panel-body">

        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>

        <div class="col-xs-10 x-panel-layout-right">

          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire"></i>&nbsp;&nbsp;<span>新闻数据&nbsp;-&nbsp;新闻列表</span></h2>
            </div>
          </div>
          
         <div class="x-toolbar-wrapper top-margin-20 clearfix">
            <div class="btn-group pull-right">
               <a href="${ctx.host}/news/create" class="btn btn-default x-btn btn-shadow btn-shadow-default" >
                 <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;添加新闻
               </a>
               <a href="${ctx.host}/news/search${not empty queryString ? '?'.concat(queryString) : ''}" data-target="#" data-toggle="modal" title="过滤查询" class="btn btn-default x-btn btn-shadow btn-shadow-default">
                 <i class="glyphicon glyphicon-search"></i>&nbsp;&nbsp;过滤查询
               </a>
            </div>
          </div>
          
          <table class="table table-striped table-hover x-table bottom-margin-20">
            <thead>
              <tr>
                <th style="width: 200px;">新闻封面</th>
                <th class="text-left">新闻信息</th>
                <th style="width: 200px;">操作</th>
              </tr>
            </thead>

            <tbody>
              <c:forEach var="news" items="${news}">
                <tr>
                  <td><img src="${cloud.prod}/${news.cover}-0.6" style="max-height: 120px; " /></td>  
                  <td class="text-left">
                    <p style="margin: 12px 0px">
                      <c:if test="${news.serial > 100}">
                        <label class="label label-success">已置顶</label>&nbsp;&nbsp;
                      </c:if>
                      <strong>${news.name}</strong>
                    </p>
                    <p>${news.summary}</p>
                    <p style="margin: 12px 0px"><fmt:formatDate value="${news.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></p>
                  </td>
                  <td class="text-center">
                    <a href="${ctx.host}/news/${news.id}" data-target="#" title="详情">详情</a>&nbsp;&nbsp;
                    <a href="${ctx.host}/news/${news.id}/delete" title="删除" data-target="#delete" data-toggle="modal">删除</a>&nbsp;&nbsp;
                    <br/><br/>
                    <a href="${ctx.host}/news/${news.id}/stick" data-target="#stick" data-toggle="modal" title="置顶">置顶</a>&nbsp;&nbsp;
                    <c:if test="${news.serial > 100}">
                      <a href="${ctx.host}/news/${news.id}/unstick" data-target="#unstick" data-toggle="modal" title="取消置顶">取消置顶</a>
                    </c:if>
                  </td>
                </tr>
              </c:forEach>
            </tbody>
          </table>
          
          <div class="form-horizontal clearfix">
            <jsp:include page="/WEB-INF/include/page.jsp">
              <jsp:param name="url" value="news" />
              <jsp:param name="queryString" value="${queryString}" />
            </jsp:include>
          </div>
          
        </div>

      </div>
    </div>
  </div>

  <%@ include file="/WEB-INF/include/script.jsp"%>
  
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/content/news/news-list.js">
    <script type="text/javascript">
      require(['page/content/news/news-list'],function(page){
          page.init();
      })
    </script>
  </d:resource>
  
</body>

</html>